<?
	@session_start();

	$id = $_GET[uid];
	$name = $_GET[uname];
	$price = $_GET[uprice];

	$name = urldecode($name);

	$order_counter = count($_SESSION[sess_id]);

	$id_already = -1;
	
	//ตรวจดูว่าซ้ำไม๊ ถ้าซ้ำ จะเพิ่มลงในรายการเดิม
	for( $x=0 ; $x < $order_counter ; $x++ )
	{
		$sessid = $_SESSION[sess_id][$x];
		if( $sessid == $id )
		{
			$id_already = $x;
			break;	
		}
	}

	if( $id_already == -1 )
	{
		$_SESSION[sess_id][$order_counter] = $id;
		$_SESSION[sess_name][$order_counter] = $name;
		$_SESSION[sess_price][$order_counter] = $price;
		$_SESSION[sess_num][$order_counter] = $num;
	}
	else
	{
		$newnum = $_SESSION[sess_num][$id_already];
		$newnum += $num;
		$_SESSION[sess_num][$id_already] = $newnum;
	}

	echo "OK"; 
?>